﻿package mortal.game.view.copy.groupCopy.view
{
    import Message.Public.*;
    import com.mui.controls.*;
    import flash.events.*;
    import flash.text.*;
    import mortal.common.font.*;
    import mortal.game.cache.*;
    import mortal.game.manager.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class GroupCopyInviteIcon extends HintBaseIcon
    {
        private var _inviteNum:GTextFiled;
        private static var _sGroupCopyInvite:SGroupCopyInvite;
        private static var _instance:GroupCopyInviteIcon;

        public function GroupCopyInviteIcon()
        {
            super(ImagesConst.GroupCopyIcon);
            this.layer = LayerManager.smallIconLayer;
            return;
        }// end function

        public function set sGroupCopyInvite(param1:SGroupCopyInvite) : void
        {
            _sGroupCopyInvite = param1;
            this.setIconAndNum();
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.mouseChildren = false;
            this.buttonMode = true;
            this.mouseEnabled = true;
            var _loc_1:* = new TextFormat(FontUtil.defaultName, 9, 16777215);
            this._inviteNum = UIFactory.gTextField("", 19, 11, 20, 20, this, _loc_1);
            this.setIconAndNum();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._inviteNum.dispose(param1);
            this._inviteNum = null;
            _sGroupCopyInvite = null;
            return;
        }// end function

        private function setIconAndNum() : void
        {
            this._inviteNum.text = Cache.instance.group.groupCopyInviteList.length.toString();
            return;
        }// end function

        override protected function clickHandler(event:MouseEvent) : void
        {
            GroupCopyInviteWin.instance.show();
            GroupCopyInviteWin.instance.updateInviteList();
            this.hide();
            return;
        }// end function

        public static function get instance() : GroupCopyInviteIcon
        {
            if (!_instance)
            {
                _instance = new GroupCopyInviteIcon;
            }
            return _instance;
        }// end function

    }
}
